package baozi;

import java.util.ArrayList;

public class ChiHuo extends Thread {
	ArrayList<BaoZi> basket = new ArrayList<BaoZi>();
	public ChiHuo(String name,ArrayList<BaoZi> basket){
		super(name);
		this.basket=basket;
	}
	
	@Override
	public void run() {
		int index = 0;
		while(true){
			synchronized (basket) {
				if(basket.size() == 0){
					try {
						basket.wait();
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
				BaoZi bz = basket.get(index);
				System.out.println(getName()+"�ڳ�"+bz.pi+bz.xier+"����");
				basket.remove(index);
				basket.notify();
			}
		}
	}

}
